package cn.yunhe.Dao.Impl;

import java.util.List;

import org.apache.ibatis.session.SqlSession;

import cn.yunhe.Dao.BookDao;
import cn.yunhe.entity.Book;

public class BookDaoImpl implements BookDao{
	SqlSession session = cn.yunhe.util.Factory.getSqlSession();
	@Override
	public List<Book> getAll() {
		List<Book> list = session.selectList("cn.yunhe.Dao.BookDao.getAll");  
		return list;
	}

	@Override
	public int addBook(Book book) {
		int add = session.insert("cn.yunhe.Dao.BookDao.addBook", book);
		session.commit();
		return add;
	}

	@Override
	public int delBook(int id) {
		int del = session.delete("cn.yunhe.Dao.BookDao.delBook", id);
		session.commit();
		return del;
	}

}
